CREATE OR REPLACE function fbi_password() returns trigger as $body$
begin
	update password set idestado=2 where idusuario = new.idusuario;
	return new;
end;
$body$ language plpgsql;

CREATE trigger tbi_password 
before insert on password
for each row execute procedure fbi_password();


